Skip to content

Sync the content/users trio fixtures and backports to trunk (r65075 / r65002) - #16

Merged
nikmclaughlin merged 3 commits into
mainfrom
add/trio-trunk-sync
Nov 10, 2026
Merged

nikmclaughlin merged 3 commits into
mainfrom
add/trio-trunk-sync

Conversation

@nikmclaughlin

Copy link
Copy Markdown
Contributor

What?

§7.0b trio trunk-sync refresh (stacked on the §7.0 meta-flag PR): the content and users trunk fixture snapshots are refreshed from today's wordpress-develop trunk and the two backports are regenerated through tools/coreify.php --reverse and replaced verbatim: core/content-query takes core's r65075-era class (the author-visibility rework) and core/users-query takes core's r65002-era class (the registered/dotted-fields rework). core/settings-get was already current with trunk — untouched. Tests update for core's new shapes; CHANGELOG.md gains ### Changed entries (the users one is breaking).

Why?

The §7.0 preflight ( Worker A stop-and-report, recorded in the plan §10.7) verified against today's trunk that our fixture snapshots (2026-10-20 refresh, re-verified 2026-10-23) predate two core changes the AI plugin's 1.5.0 synced copies already carry — i.e. core-side progress, not plugin drift: a core/content-query and core/users-query that stay one sync behind would ship behaviors core no longer carries. The plugin's PoC pins one package integration ref, so this sync lands stacked before the ai PoC pins its ref. Spec: PLAN-ai-plugin-poc.md §7.0b, §10.7 (finding 7), worker brief tools/out/worker-a2-brief.md.

How?

  1. Fixture refresh: both trunk classes fetched fresh today (verified byte-identical to the §7.0 preflight's copies — trunk stable over the interval), written to tests/Fixtures/abilities-api/ with provenance headers updated in the existing convention (Refreshed: 2026-11-06 by Worker A (§7.0b trio trunk-sync refresh...); ..., verified against the WordPress/ai 1.5.0 synced copy).
  2. Regeneration: coreify --reverse on both fixtures; the outputs replace src/Content/Content_Query.php / src/Users/Users_Query.php verbatim (code), with the §7.0 hand-finished comment shell re-applied (file header, class + authoring-method docblocks, the input_schema() prologue comments, and the trunk is_string guard's @phpstan-ignore note) — all comment/whitespace-only, and the mB drift-guard verifies shipped ≡ reverse(fixture) stays green. The §7.0 accommodation survives regeneration by design: both regenerated files carry 'show_in_rest' => true behind the exact PKG_META_ACCOMMODATIONS // Package: marker lines (verified).
  3. One profile update: the core/users-query coreify profile imports gain DateTimeZone (core r65002 introduces it in the class) — the profile imports key is the designed mechanism for the package use block.
  4. Tests (adapted, never deleted — §4 allows modifying shape assertions core forces):
    • UsersQueryTest: TRUNK_FIELDS gains registered (replacing registered_date) plus a new TRUNK_FIELD_PATHS for the dotted fields enum; the self-view assertion checks the registered{site,gmt} object; new test_execute_dotted_field_projection pins path-level sub-field projection.
    • ContentQueryTest: schema pins for the new where.author object (id min 1 / slug minLength 1 / additionalProperties: false / minProperties: 1); the date field paths become date.site/modified.site; the old "unknown author slug ⇒ error" case adapts to core's new answer (unknown/invisible author ⇒ empty page, no error), and the filter-level rejections move to the new error paths (where[author], where[author][id], where[author][slug]); new tests pin the author filter (id matches the stored author, id+slug mismatch ⇒ empty page), the author-field visibility rule (null name/slug for an invisible author; the edit_user branch opens the identity), and the per-query memoization (a memoized judgment is honored; a fresh query resets the memo). Cap isolation rides on user-level caps only — never site roles (the test also cleans up any previously persisted test role).
  5. Gates: see Testing Instructions — including both wp-env suites (288 tests each, up from 284 with the four new tests).

Diff vs. expectations (brief §3 — stop-and-report gate)

The code-level diff of both regenerated backports against their §7.0-era versions was reviewed hunk-by-hunk. Everything falls within the expected sync-delta set, with two same-sync trunk modernizations the brief's headline did not name explicitly — surfaced here and in the CHANGELOG rather than absorbed silently:

  • Expected (the r65075 author-visibility machinery): the $visible_authors per-query memo, get_visible_author() with the edit_user branch and the show_in_abilities-restricted viewable posts count (replacing get_author_by_slug()), the author-field visibility nulling, and the integral where.author object-filter rework (the filter and field share the visibility rule; error paths and empty-page semantics listed above).
  • Expected (the r65002 registered/dotted-fields machinery): the registered{site,gmt} schema/output, format_registered_date(), get_field_paths(), is_field_requested() via rest_is_field_included(), and the dotted fields enum.
  • Same-sync modernization, surfaced (1): date.local → date.site (and modified.local → modified.site) — the same dotted-field rename class as users' registered, arriving with the sync window. ContentCreate/ContentUpdate's date.local input contract is the package-authored write ability (ai PR #1025 port), unaffected and untouched.
  • Same-sync modernization, surfaced (2): array_all() / array_any() replace two loops in the content class. These are PHP 8.4 functions, but runtime-safe on every supported floor: core's own wp-includes/compat.php polyfills both (verified in trunk, @since 6.8.0; trunk's $required_php_version remains 7.4). The plugin copies swap them for loops only because its static-analysis WP stubs do not declare them — not a runtime constraint.
  • Nothing else: no unplanned behavioral deltas, and the settings fixture is byte-identical to today's trunk.

⚠️ Stack and integration pin

Stacked on §7.0 PR #15 (add/trio-show-in-rest @ 9ab085d), which is stacked on #12 (00d65cf). Not to be merged until the team resolves #12 and the §7.0 PR. Note for the ai PoC: the integration pin moves to this PR's head SHA (add/trio-trunk-sync) — its vendored snapshot then carries main + #12 + §7.0 (the meta flag) + this sync, per the plan §11 work order.

Use of AI tools

Tool(s): goose (agent) via the Solo orchestration harness. Model(s): glm-5.3-flash:cloud. Used for: fixture refresh, regeneration+verification, tests, gate runs, and this description's drafting basis (plan-driven per PLAN-ai-plugin-poc.md §7.0b; worker brief tools/out/worker-a2-brief.md). Reviewed and edited by the committer.

Testing Instructions

  1. composer run lint:phpcs && composer run lint:phpstan && composer run verify:manifest && composer run verify:coreify — all clean; verify:coreify PASS on all three pairs (mA + mB), round-trip invariant holds, and --reverse on the refreshed fixtures regenerates files that already carry the // Package:-marked flag.
  2. PHPUnit on both wp-env environments, one at a time (full suites — single-class --filter runs are not meaningful here: registration is suite-context-dependent):
    • npx @wordpress/env start --config=.wp-env.stable.json --update && npx @wordpress/env run tests-cli --config=.wp-env.stable.json bash -c "cd wp-content/plugins/wordpress-abilities && vendor/bin/phpunit"
    • same for .wp-env.trunk.json
    • 288 tests pass on both (stable: 3297 assertions; trunk: 3245) with the one pre-existing upstream-faithful cast warning and the pre-existing skips, unchanged by this diff.

Changelog entries

### Changed (CHANGELOG.md): the users-query registered_date → registered dotted-object breaking change; the content-query author-visibility/filter rework and date.site rename; the trunk fixture snapshot refresh.

PLAN-mcp-adapter-poc.md step 1.5 (sec. 1 resolution, sec. 4.0): the 8 media/terms
abilities — wp/media-query, wp/media-upload, wp/media-update, wp/media-delete,
wp/terms-query, wp/term-create, wp/term-update, wp/term-delete — did not carry
the public meta, so the MCP adapter's McpAbilityExposure falls back to
meta.public and excludes them from the MCP surface. This adds the MCP-specific
flag mcp => array( public => true ) to their ability_meta(), which
McpAbilityExposure checks first, without changing their high-level publicness
(no public key added) — the team decides between the mcp flag and full
meta.public before this lands on the package's main.

annotations/show_in_rest and every other meta key are untouched; no other
ability changes. The Registrar's Gate-6 public_only probe reads the ability's
own public meta only — the flag is additive there.

Tests: the registered-once tests of the 8 abilities (media-query/upload/
update/delete, terms-query, and the term-writes contract test) each now also
assert the exact mcp meta shape ( array( public => true ) ) and that the
high-level public meta is unchanged (get_meta_item( 'public', false ) ===
false). No assertions were deleted.
PLAN-ai-plugin-poc.md sec. 7.0 (sec. 10.2 resolution, Option A): core/content-query,
core/settings-get and core/users-query gain 'show_in_rest' => true in ability_meta()
under a // Package: marker, so the abilities stay exposed over core's REST abilities
routes on every supported WordPress (6.9+) — core's own registration omits the flag
and relies on meta.public seeding it, which WordPress 7.1+ only does. On 7.1+ the
seeding makes the flag redundant but harmless. The same accommodation the AI plugin's
synced copies carry with their // Plugin: marker, made once in the package.

tools/coreify.php tolerates exactly this marked line and nothing more, symmetrically:
a narrow PKG_META_ACCOMMODATIONS map (meta key => marker-comment lines) makes
--reverse re-inject the flag (plus markers) into regenerated backports when the
fixture's meta lacks it, and forward drop it behind marker-verbatim checks when
unwrapping ability_meta() into core-shaped registration args — both semantic-diff
invariants of the check gate stay green, and a mapped key without the const's exact
markers fails the forward path loudly. The trio tests now pin meta.show_in_rest ===
true with the high-level public meta unchanged (PR #12's pattern).

Stacked on #12 (add/mcp-public-meta) so the ai PoC pins one integration ref.
PLAN-ai-plugin-poc.md sec. 7.0b (from the sec. 10.7 preflight stop-and-report):
our trunk fixture snapshots predated two core changes the AI plugin's copies
already carry — content r65075 (author-visibility rework) and users r65002
(registered/dotted-fields rework). Refresh both fixtures from today's
wordpress-develop trunk (settings was already current), regenerate
src/Content/Content_Query.php and src/Users/Users_Query.php verbatim through
coreify --reverse (the sec. 7.0 show_in_rest '// Package:' meta accommodation
survives regeneration by design; PKG_META_ACCOMMODATIONS markers unchanged),
and update the tests for core's new shapes.

Sync deltas, verified hunk-by-hunk against the expected set:
- content: get_visible_author() memoized per query via $visible_authors, an
  edit_user capability branch, the posts count restricted to show_in_abilities-
  exposed viewable post types, the author field nulling name/slug for authors
  the current user may not see; where.author_slug became a where.author object
  (id/slug) with where[author]/where[author][id]/where[author][slug] error paths
  and empty-page (not error) answers for authors that name no visible user;
  date.local became date.site; trunk's array_all()/array_any() (core's compat
  polyfills cover PHP < 8.4; the users profile gains the DateTimeZone import).
- users: registered_date became the registered.site/registered.gmt object, with
  the get_field_paths()/is_field_requested() dotted projection and the dotted
  fields enum.

Tests adapt to the new shapes (registered.site/gmt, dotted fields enum, author
object filter and its error paths) and add coverage for the visible-author rule
(memoization, the edit_user branch, filter matching) and the users dotted
projection — adapted, never deleted. Settings is untouched: its fixture is
byte-identical to today's trunk.

Stacked on #15 (add/trio-show-in-rest) and #12 (add/mcp-public-meta), for the
ai PoC to pin its integration ref on this head.
@nikmclaughlin
nikmclaughlin merged commit 4627912 into main Nov 10, 2026
12 checks passed
nikmclaughlin added a commit that referenced this pull request Nov 11, 2026
The build spec served its purpose: WP0-WP7 are complete and the prototype
has shipped (PRs #2-#16). Its durable content lives in the product docs
(README, NAME-LIFECYCLE.md, CONTRIBUTING.md); git history retains the
file. The document contained local-machine paths and agent-workflow
details unsuitable for a centrally-owned repository.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant